package xyz.jcat.biz.leaf.dubbo;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import xyz.jcat.common.util.IdWorker;
import xyz.jcat.leaf.LeafIdWorker;

@DubboService
public class LeafIdWorkerDubboService implements IdWorker {

    @Value("${leaf.idWorker.key}")
    private String key;

    @Autowired
    private LeafIdWorker leafIdWorker;

    @Override
    public Long nextId() {
        return leafIdWorker.nextId(key);
    }

}
